<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <script>

        var num = -100;
        console.log(Math.abs(num))   //绝对值
        console.log(Math.max(10,20,30,-50))  //最大值
        console.log(Math.min(10,20,30,-50))  //最小值

        var num2 = 10.56789;
        console.log(Math.ceil(num2))  //向上取整
        console.log(Math.floor(num2)) //向下取整
        console.log(Math.round(num2)) //四舍五入

        console.log(Math.random())  //随机数 0-1之间的随机小数

        function getRandom(min,max){
            //返回min到max之间的随机小数
            return Math.random()*(max-min)+min
        }

    </script>


</body>
</html>